﻿using System;
using NUnit.Framework;

namespace NJabber
{
    [TestFixture]
    public class XmlNamespaceTest
    {
        protected readonly string NamespaceName = "test";
        protected readonly string NamespaceUri = "test:namespace:uri";

        [Test]
        public void Construct_CorrectParameters()
        {
            XmlNamespace ns = new XmlNamespace(NamespaceName, NamespaceUri);
            Assert.AreEqual(NamespaceName, ns.Name);
            Assert.AreEqual(NamespaceUri, ns.Uri);
        }

        [Test]
        [ExpectedException(typeof(ArgumentException))]
        public void Constructor_IncorrectNameParameter_ThrowException()
        {
            XmlNamespace ns = new XmlNamespace("name:", NamespaceUri);
        }

        [Test]
        public void IsEmpty_EmptyNameAndNamespace_ReturnsTrue()
        {
            XmlNamespace ns = new XmlNamespace("", "");
            Assert.IsTrue(ns.IsEmpty);
        }

        [Test]
        public void IsEmpty_NotEmptyNameAndNamespace_ReturnsFalse()
        {
            XmlNamespace ns = new XmlNamespace(NamespaceName, NamespaceUri);
            Assert.IsFalse(ns.IsEmpty);
        }
    }
}
